<template>
  <div >
    <el-table
      :data="tableData"
      border
      style="width: 100%"
      :row-class-name="tableRowClassName">
      <el-table-column
        prop="id"
        label="编号"
        width="180">
      </el-table-column>
      <el-table-column
        prop="name"
        label="姓名"
        width="180">
      </el-table-column>
      <el-table-column
        prop="phone"
        label="电话">
      </el-table-column>
      <el-table-column
        prop="email"
        label="邮箱"
        width="180">
      </el-table-column>
      <el-table-column
        prop="address"
        label="地址"
        width="180">
      </el-table-column>
      <el-table-column
        prop="createTime"
        label="时间">
      </el-table-column>
    </el-table>
<!--    分页的信息-->
    <el-pagination
      background
      layout="prev, pager, next"
      :total="totals"
      :page-size="pageSize"
      :current-page="currentPage"
      @current-change="gotpage">
    </el-pagination>
  </div>
</template>

<script>

export default {
  data () {
    return {
      totals:0,
      pageSize:6,
      currentPage:1,
      tableData:[]
    }
  },methods:{
    getDate(){
      let paerm={"currentPage":this.currentPage,"pageSize":this.pageSize}
      //  使用axios访问后端接口，全局axios访问
      this.$http.post("/user/list",paerm)
      .then(res=>{
        this.tableData=res.data.data
        this.totals=res.data.totals
      })
      .catch(res=>{
        alert("嗨嗨")
      })
    },gotpage(ys){
      this.currentPage=ys
      this.getDate()
    }
  },mounted() {
    this.getDate()
  }
}
</script>


